import logging
import os
import qianfan
from qianfan.common import Prompt
from qianfan.common.hub import hub

os.environ["QIANFAN_ACCESS_KEY"] = ""
os.environ["QIANFAN_SECRET_KEY"] = ""

chat_comp = qianfan.ChatCompletion()


def getMsg(msg):
    logging.info('调用默认模型，即 ERNIE-Bot-turbo')
    # 调用默认模型，即 ERNIE-Bot-turbo
    resp = chat_comp.do(model='ERNIE-3.5-8K-0205',
                        messages=[{"role": "user", "content": msg}])

    return resp['result']

# def getInfo(msg):
#     logging.info('调用默认模型，即 ERNIE-Bot-turbo')
#     # 调用默认模型，即 ERNIE-Bot-turbo
#     resp = chat_comp.do(model='ERNIE-3.5-8K-0205', messages=[{
#         "role": "user",
#         "content": '你们'
#     }])
#     return resp


if __name__ == '__main__':
    msg = getMsg('你好')
    print(msg)
